package tmt.usercenter.web.domain.enums;

import com.tmt.annotation.EnumDescriptor;
import com.tmt.annotation.parser.EnumAnnotationParser;
import lombok.Getter;

@Getter
public enum SystemParamCode {

    @EnumDescriptor(title = "凌凯科技短信使能", description = "凌凯科技短信使能")
    SM_ENABLE_LK("true"),

    @EnumDescriptor(title = "凌凯科技短信帐号", description = "凌凯科技短信帐号")
    SM_ACCOUNT_LK("LKSDK0003918"),

    @EnumDescriptor(title = "凌凯科技短信帐号的密码", description = "凌凯科技短信帐号的密码")
    SM_PASSWORD_LK("Qwerty123456"),

    @EnumDescriptor(title = "凌凯科技短信发送URL", description = "凌凯科技短信发送URL")
    SM_URL_LK("http://mb345.com/WS/BatchSend.aspx?CorpID={0}&Pwd={1}&Mobile={2}&Content={3}&Cell=&SendTime={4}"),

    @EnumDescriptor(title = "随机用户帐号的长度", description = "随机用户帐号的长度")
    RANDOM_USER_NAME_LEN("6"),

    @EnumDescriptor(title = "锁粉列表最大查询深度", description = "锁粉列表最大查询深度")
    MAX_LEVEL_FOR_FANS_LIST("2"),

    @EnumDescriptor(title = "重置密码采用的模式", description = "找回密码采用的模式：email 或 mobile |每天可重置的次数")
    RETRIEVE_PASSWORD_MODE("mobile|1"),

    @EnumDescriptor(title = "手机模式下重置密码发送给用户的文字信息", description = "{0}填充当前密码；{1}填充账号; {2}填充手机号码或邮箱地址")
    RETRIEVE_PASSWORD_MESSAGE_BY_MOBILE("您找回的账号密码为：{0}，登录后及时更换密码！"),

    @EnumDescriptor(title = "电子邮箱模式下重置密码发送给用户的文字信息", description = "{0}填充当前密码；{1}填充账号; {2}填充手机号码或邮箱地址")
    RETRIEVE_PASSWORD_MESSAGE_BY_EMAIL("<div>T您找回的账号密码为：<span style='color:blue; font-size:30px;'>{0}</span>，登录后及时更换密码！</div>"),

    @EnumDescriptor(title = "同一电话号码短信发送间隔时间", description = "单位：分钟")
    SM_INTERVAL_MINUTES("2"),

    @EnumDescriptor(title = "X分钟内最大连续登录尝试次数", description = "格式：{累计时间段(单位:分钟)}>{最大错误次数}")
    MAX_LOGIN_ATTEMPT_COUNT("5>5"),

    @EnumDescriptor(title = "KindEditor上传文件最大长度", description = "KindEditor上传文件最大长度(字节)")
    UPLOAD_FILE_MAX_LEN("500000"),

    @EnumDescriptor(title = "允许的上传文件类型", description = "允许的上传文件类型")
    UPLOAD_FILE_ALLOW_TYPE("jpg, jpeg, gif, png"),

    @EnumDescriptor(title = "使能短信服务")
    ENABLE_SM_SERVICE("true"),

    ;

    private String paramValue;

    SystemParamCode(String paramValue) {
        this.paramValue = paramValue;
    }

    public static SystemParamCode from(String title) {
        return EnumAnnotationParser.convertFromTitle(SystemParamCode.class, title);
    }
}
